<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>数据文档管理</title>



<link rel="stylesheet" href="/css/theme/font-awesome.min.css" type="text/css" />		
<link rel="stylesheet" href="/css/theme/bootstrap.min.css" type="text/css" />	
<link rel="stylesheet" href="/css/theme/App.css" type="text/css" />
<link rel="stylesheet" href="/javascript/theme/libs/jquery-easyui-1.4/themes/gray/easyui.css" type="text/css" />	
	
<script src="/javascript/theme/libs/jquery-1.9.1.min.js"></script>
<script src="/javascript/theme/App.js"></script>
<script src="/javascript/theme/libs/jquery-easyui-1.4/jquery.easyui.min.js"></script>


<script >
$(function(){
               $("#fileCate1").combobox({
               		selectOnNavigation: true,
               		onSelect: function(newVal,oldVal){
               			var cate1 = $("#fileCate1").combobox('getValue');
               			var url ="/uploadDoc/getAllFileCate2?fileCate1="+cate1;
               			$("#fileCate2").combobox('reload',url);
               		}
               });
               $("#fileCate1").combobox('setValue',$('#initalCate1').val());
               $("#fileCate2").combobox('setValue',$('#initalCate2').val());
});	 
			 
function updateState(id,upstate){
		 		var flag = false;
				if(upstate == '0'){
					  flag = confirm("删除后不能恢复，确定删除？");
				}
				if(flag == false)
					return false;
			 	jQuery.ajax({
        			url:"/uploadDoc/manage/changeState",
            		type:"post",
            		async:true,
            		data:{"upstate":upstate,"id":id},
            		success:function(data){
                		if(data == "error"){
							alert("操作失败！");
						}else if(data == "success"){
							alert("操作成功！");
							document.searchUser.submit();
						}else{
							alert(date);
						}
            		}
            	});
            	return false;
}
			 
$(function(){
	$("#toUploadDoc").click(function(){
		window.location.href="/uploadDoc/manage/toupload";
	});
});
		 
function checkParam(){
	var cate1 = $("#fileCate1").combobox('getText');
	var cate2 = $("#fileCate2").combobox('getText');
	$("#fileCate1").combobox('setValue',cate1);
	$("#fileCate2").combobox('setValue',cate2);
	return true;
}
		 
</script>

</head>
<body>
<div id="content" style="OVERFLOW-X:yes;OVERFLOW-Y:auto;min-height:800px">		
		
	
	
	<input type="hidden" id="pageindex" name="pageindex" value="$!{pageIndex}"/>	
	<div id="content-container">
		<form onsubmit="return checkParam();" id="searchUser" name="searchUser" action="/uploadDoc/manage/manage" method="post">
    	<div class="portlet">
				<div class="portlet-header">
					<h3>
						<i class="fa fa-tasks"></i>
						数据文档管理
					</h3>
			
				</div> <!-- /.portlet-header -->
			
    				<div class="portlet-content">
						
    						<div class="form-group">
								<label class="col-md-2">文件名：</label>
    							<div class="col-md-2">
    							  <input type="text" id="initalFileName" name="initalFileName" value="$!{initalFileName}"class="form-control"/>
                                </div>
    							
								<label class="col-md-2">类别一:</label>
								<div class="col-md-2">
    								<input type="hidden" id="initalCate1" value="$!fileCate1"/>
									<select  id="fileCate1" name="fileCate1" value="$!{fileCate1}" style="width:130px;height:25px">
											#foreach( $cate1 in $cate1List)
												<option value="$!{cate1}"  #if($cate1 == $!{fileCate1}) selected #end>$!{cate1}</option>
											#end
									</select>
    							 </div>
								 
    							<label class="col-md-2">类别二:</label>
    							<div class="col-md-2">
    								<input type="hidden" id="initalCate2" value="$!fileCate2"/>
									<select class="easyui-combobox" id="fileCate2" name="fileCate2" value="$!fileCate2"  data-options="valueField: 'value',textField: 'value'" style="width:130px;height:25px">
											#foreach( $cate2 in $cate2List)
												<option value="$!{cate2}"  #if($cate2 == $!{fileCate2}) selected #end>$!{cate2}</option>
											#end
									</select>	
                                </div>
    							
								&nbsp;&nbsp;&nbsp;&nbsp;
								<button type="submit" id="searcheFile" name ="searcheFile" class="btn btn-primary btn-xs">查询</button>
								&nbsp;&nbsp;&nbsp;&nbsp;
								<button type="button" id="toUploadDoc" name ="toUploadDoc" class="btn btn-primary btn-xs">上传新文档</button>
								&nbsp;&nbsp;&nbsp;&nbsp;
								<span style="color:red">
									( 提示:只能管理自己上传的文档 )
								</span>
    						</div>
    
    						
    			
    				</div> <!-- /.portlet-content -->
			
		</div> <!-- /.portlet -->	
        </form>
		
		
			<div class="portlet">
    
    					
							<div class="portlet-header">
    
    							<h3>
    								<i class="fa fa-hand-o-up"></i>
    								查询结果
    							</h3>
    
    						</div> <!-- /.portlet-header -->
    
							
							
    						<div class="portlet-content">						
    							<div class="table-responsive">
    
									<!--table begin -->
        							<table 
        								class="table table-striped table-bordered table-hover" 
        								data-provide="datatable" 
        								data-display-rows="20" 
        							>
        									<thead>
        										<tr>
													<th  style="text-align:center;"  width="25%">文件名</th>
													<th  style="text-align:center;" width="12%">类别一</th>
													<th  style="text-align:center;" width="13%">类别二</th>
													<th  style="text-align:center;" width="15%">文件描述</th>
													<th  style="text-align:center;" width="8%">上传者</th>
													<th  style="text-align:center;" width="12%">上传时间</th>	
													<th  style="text-align:center;" width="15%">操作</th>
        										</tr>
        									</thead>
        									<tbody>
												 #foreach($rs in $rsList)
                                            		<tr  align="center" >
                                            		   <td>$rs.initalFileName</td>
                                                       <td>$!rs.fileCate1</td>
                                                       <td>$!rs.fileCate2</td>
                                                       <td>$!rs.fileDescribe</td>
                                                       <td>$!rs.fileCreater</td>
                                               		   <td>$!{tools.getDateStringFromDate(${rs.uploadTime})}</td>
                                                       <td id="reportstate" name="reportstate" >
                                        				<a style="color:green" href="/uploadDoc/showDetail?fileName=$rs.initalFileName&saveName=$!{rs.saveName}&fileType=$!{rs.fileType}">查看</a> &nbsp  
                                        				<a style="color:green" href="/uploadDoc/manage/toEdit?id=$!{rs.id}">修改</a> &nbsp  
                                        				#if($rs.state == 1)
                                        					<a style="color:red" href="javascript:void(0)" onclick="updateState('$rs.id','0')">删除</a>&nbsp 
                                        				#elseif($rs.state == 0)
                                        					<a style="color:blue" href="javascript:void(0)" onclick="updateState('$rs.id','1')">恢复</a>
                                        				#end
                                        			   </td>
                                                    </tr>	
                                        		#end
												
        									</tbody>
        								
        							</table>
        							<!--table end -->
										
    								<!--paginate begin -->
    								<div class="row dt-rb">
    									#parse("/views/default/newpage.vm")
										#pagenew($pList "/uploadDoc/manage/manage?#page#&$paramurl")
                                    </div>
    								<!--paginate end -->
    								
									
                                </div>
							</div> <!-- /#portlet-content -->
								
							 
								
    						</div> 
		
		
	</div> <!-- /#content-container -->
	
</div> <!-- #content -->
	

</body>
</html>